package com.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.dao.DeptDao;
import com.dao.DeptDaoImpl;
import com.entity.Dept;
import com.entity.Emp;

@Controller
@RequestMapping(value="/emp")
public class EmpHandler {
	private DeptDao deptDao = new DeptDaoImpl();
	@RequestMapping("/tosave")
	public String tosave(Map<String,Object> map){

		map.put("emp", new Emp());
		//性别信息
		Map<Integer,String> sexMap = new HashMap<Integer,String>();
		sexMap.put(1,"男");
		sexMap.put(0,"女");
		map.put("sexMap", sexMap);
		//部门信息
		List<Dept> deptList = deptDao.findAll();
		map.put("deptList", deptList);
		
		return "emp_save";
	}
	
	@RequestMapping("/save")
	public String save(Emp emp){
		System.out.println("emp=========="+emp);
		return "success";
	}
}
